import Vue from 'vue'
import store from '@/store'

const btn = Vue.directive('btn', {
    inserted: function (el, binding) {
        const btns = store.state.user.info["buttons"]
        if(binding && binding.value && btns && btns.length>0){
            if(!btns.includes(binding.value)){
                el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none')
            }
        }else{
            el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none')
        }
        
    }
  })
export default btn